package service;

import model.Item;
import model.Order;
import model.OrderModificationRequest;
import repository.OrderRepository;

import java.time.Clock;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单服务实现
 */
public abstract class BaseOrderService implements OrderService {
    protected final OrderRepository repository;
    protected final Clock systemClock;
    
    public BaseOrderService(OrderRepository repository) {
        this.repository = repository;
        this.systemClock = Clock.systemDefaultZone();
    }
    
    @Override
    public Order createOrder(List<Item> items, boolean isVIP) {
        return createOrder(items, isVIP, LocalDateTime.now(systemClock));
    }
    
    @Override
    public void cancelOrder(String orderId) {
        cancelOrder(orderId, LocalDateTime.now(systemClock));
    }

    @Override
    public Order modifyOrder(String orderId, OrderModificationRequest request) {
        return modifyOrder(orderId, request);
    }
} 